<?php /* УТФ-8:fix */

class SPIcore__session
{
    public function id()
    {
        session_start();
        $session_id = session_id();
        session_write_close();

        return $session_id;
    }

    public function set_var( $name, $value )
    {
        session_start();

        $_SESSION[ $name ] = $value;

        session_write_close();

        return true;
    }

    public function get_var( $name )
    {
        session_start();

        if( isset( $_SESSION[ $name ] ) === false )
        {
            session_write_close();

            return null;
        }

        session_write_close();
        
        return $_SESSION[ $name ];
    }

    public function destroy()
    {
        session_start();
        session_destroy();
        unset( $_SESSION );

        return true;
    }
}
